//  The Vue build version to load with the `import` command
//  (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import filter from './filter'
import tools from '@utils/tools'
import Mint from 'mint-ui'
import VueScroller from 'vue-scroller'
import FastClick from 'fastclick'
import Vuex from 'vuex'
import Navigation from 'vue-navigation'
import Card from '@components/Card'
import CardHeader from '@components/Card/Header'
import CardContent from '@components/Card/Content'
import CardFooter from '@components/Card/Footer'
import Page from '@components/Page'
import PageHeader from '@components/Page/PageHeader'
import PageContent from '@components/Page/PageContent'
import PageFooter from '@components/Page/PageFooter'
import Loading from '@components/common/Loading'
import 'mint-ui/lib/style.css'
import 'font-awesome/css/font-awesome.css'
import '@static/css/public.css'

Vue.use(VueScroller)
Vue.use(Vuex)
Vue.use(Navigation, {router, store})

Vue.use(tools)
Vue.use(Mint)
Vue.use(filter)

Vue.component('Card', Card)
Vue.component('CardHeader', CardHeader)
Vue.component('CardContent', CardContent)
Vue.component('CardFooter', CardFooter)
Vue.component('Page', Page)
Vue.component('PageHeader', PageHeader)
Vue.component('PageContent', PageContent)
Vue.component('PageFooter', PageFooter)
Vue.component('Loading', Loading)

router.beforeEach(function (to, from, next) {
  store.dispatch('updateLoadingStatus', { isLoading: true })
  next()
})
router.afterEach(function (to) {
  store.dispatch('updateLoadingStatus', { isLoading: false })
})
Vue.config.productionTip = false

FastClick.attach(document.body)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  template: '<App/>',
  components: { App }
})
